package main

import (
	"Gin-Gorm-boke/boke_common/kafka"
	"Gin-Gorm-boke/boke_user/router"
	"Gin-Gorm-boke/boke_user/task"
	"fmt"
	"github.com/robfig/cron/v3"
)

func main() {

	r := router4user.Router()
	//r.GET("/ws/:sid", websocket_handler.HandleWebSocket)
	// 启动 Kafka 消费者
	//go func() {
	//	if err := startConsumer(); err != nil {
	//		log.Fatalf("Error starting consumer: %v", err)
	//	}
	//}()
	c := cron.New()
	c.AddFunc("@every 5m", func() {
		task.Task4ViewCount()
	})
	c.Start()
	go func() {
		if err := kafka.StartConsumer(); err != nil {
			fmt.Println("Error starting consumer: %v", err)
		}
	}()
	r.Run(":7777")
}
